<div id="content" class="testd"><br>
<h1><?php if($title){ echo $title; } ?></h1><br>
<?php
$logged_in=$this->session->userdata('logged_in');

if($logged_in['su']=="1"){
?><a href="<?php echo site_url('result');?>">Back</a>
<?php
}else{
?>
<a href="<?php echo site_url('result/user');?>">Back</a>
<?php
}
?>
<br>
<div class="wite">
<table id="detail">
<tr><td >Result ID</td><td><?php echo $result->rid;?></td></tr>
<tr><td >User Name</td><td><?php echo $result->username;?></td></tr>
<tr><td >Email</td><td><?php echo $result->email;?></td></tr>
<tr><td >First Name</td><td><?php echo $result->first_name;?></td></tr>
<tr><td >Last Name</td><td><?php echo $result->last_name;?></td></tr>
<tr><td >Quiz Name</td><td><?php echo $result->quiz_name;?></td></tr>
<tr><td >Score obtained</td><td><?php echo $result->score."/".(count(explode(',',$result->qids)) * $result->correct_score );?></td></tr>
<tr><td >Percentage obtained</td><td><?php echo substr($result->percentage , 0, 5 );?>%</td></tr>
<tr><td >Result</td><td><?php if($result->q_result == "1"){  echo "Pass"; }else{ echo "Fail"; } ?></td></tr>
<tr><td >Total Time Spent</td><td><?php if($result->time_spent <= ($result->duration * 60 ) ){  echo gmdate("H:i:s", $result->time_spent); }else{ echo gmdate("H:i:s", ($result->duration * 60)); } ?></td></tr>


</table>
<?php if($result->view_answer =="1"){
?>
<table id="detail">
<tr><td ><a href="<?php echo site_url('result/view_answer/'.$result->rid );?>">View Answer</a></td></tr>
</table></div>
<?php
}
?>
<!-- google chart starts -->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable(<?php echo $value;?>);

        var options = {
          title: 'Top 10 results for Quiz:<?php echo $result->quiz_name;?>',
          hAxis: {title: 'Quiz(User)', titleTextStyle: {color: 'red'}}
        };

        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
		 <div id="chart_div" style="width: 900px; height: 500px;"></div>
<!-- google chart ends -->



<!-- google chart starts -->

    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable(<?php echo $qtime;?>);

        var options = {
          title: 'Time spent on individual question (in seconds)'
        };

        var chart = new google.visualization.PieChart(document.getElementById('chart_div2'));
        chart.draw(data, options);
      }
    </script>
		 <div id="chart_div2" style="width: 900px; height: 500px;"></div>
<!-- google chart ends -->



</div>
